<template>
    <div>
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>首页</el-breadcrumb-item>
            <el-breadcrumb-item>订单管理</el-breadcrumb-item>
            <el-breadcrumb-item>订单列表</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="header">
            <el-input placeholder="请输入内容" v-model="queryInfo.query" class="input-with-select">
                <template #append>
                    <el-button icon="el-icon-search" @click="getOrderList"></el-button>
                </template>
            </el-input>
        </div>
        <el-table :data="orderlist" border stripe>
            <el-table-column type="index"></el-table-column>
            <el-table-column prop="order_number" label="订单编号">
            </el-table-column>
            <el-table-column prop="order_price" label="订单价格">
            </el-table-column>
            <el-table-column label="是否付款">
                <template #default="scope">
                    <el-tag v-if="scope.row.pay_status!='0'" type="success">已付款</el-tag>
                    <el-tag v-else type="danger">未付款</el-tag>
                </template>
            </el-table-column>
            <el-table-column prop="is_send" label="是否发货">
            </el-table-column>
            <el-table-column label="下单时间">
                <template #default="scope">
                    {{scope.row.create_time}}
                </template>
            </el-table-column>
            <el-table-column label="操作" width="180px" align="center">
                <template>
                    <el-button type="primary" icon="el-icon-edit">
                    </el-button>
                    <el-button type="success" icon="el-icon-location">
                    </el-button>
                </template>
            </el-table-column>
        </el-table>

    </div>
</template>

<script>
export default {
    data () {
        return {
            queryInfo: {
                query: '',
                pagenum: 1,
                pagesize: 5
            },
            orderlist: []
        }
    },
    created () {
        this.getOrderList()
    },
    methods: {
        async getOrderList () {
            const { data: res } = await this.$http.get('orders', { params: this.queryInfo })
            if (res.meta.status !== 200) return this.$message.error('获取订单列表错误')
            console.log('获取订单列表', res.data);
            this.orderlist = res.data.goods
            this.total = res.data.total
        },

    }
}
</script>

<style lang="less" scoped>
</style>